﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using IOLib;
using SheetLib;
using SheetLib.Matan;

namespace SHS_SE
{
    public partial class SBlockProps : Form
    {
        Block mathModel;
        public SBlockProps(Block block)
        {
            InitializeComponent();
            LangSel();
            this.mathModel = block;
            bool[] par = this.mathModel.Parameters.OrderBy(p => p.Key).Select(p => (bool)p.Value).ToArray();            
            this.pictureBox1.BackgroundImage = BlockBitmapCreator.Summator(par);
            checkBox1.Checked = par[0];
            checkBox2.Checked = par[1];
            checkBox3.Checked = par[2];
        }

        private void LangSel()
        {
            this.Text = GlobalParams.LanguageForm[224];
            this.label1.Text = GlobalParams.LanguageForm[225];
            this.checkBox1.Text = GlobalParams.LanguageForm[226] + "1";
            this.checkBox2.Text = GlobalParams.LanguageForm[226] + "2";
            this.checkBox3.Text = GlobalParams.LanguageForm[226] + "3";
            this.button1.Text = GlobalParams.LanguageForm[157];
            this.button2.Text = GlobalParams.LanguageForm[158];
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.mathModel.Parameters["1"] = this.checkBox1.Checked;
            this.mathModel.Parameters["2"] = this.checkBox2.Checked;
            this.mathModel.Parameters["3"] = this.checkBox3.Checked;
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

    }
}
